home *** CD-ROM | disk | FTP | other *** search
/ NOVA - For the NeXT Workstation / NOVA - For the NeXT Workstation.iso / SourceCode / AdobeExamples / NX_HitDetect / Bezier.h < prev    next >
Encoding:
Text File  |  1992-12-19  |  3.1 KB  |  100 lines

  1.  
  2. /*
  3.  * (a)  (C) 1990 by Adobe Systems Incorporated. All rights reserved.
  4.  *
  5.  * (b)  If this Sample Code is distributed as part of the Display PostScript
  6.  *    System Software Development Kit from Adobe Systems Incorporated,
  7.  *    then this copy is designated as Development Software and its use is
  8.  *    subject to the terms of the License Agreement attached to such Kit.
  9.  *
  10.  * (c)  If this Sample Code is distributed independently, then the following
  11.  *    terms apply:
  12.  *
  13.  * (d)  This file may be freely copied and redistributed as long as:
  14.  *    1) Parts (a), (d), (e) and (f) continue to be included in the file,
  15.  *    2) If the file has been modified in any way, a notice of such
  16.  *      modification is conspicuously indicated.
  17.  *
  18.  * (e)  PostScript, Display PostScript, and Adobe are registered trademarks of
  19.  *    Adobe Systems Incorporated.
  20.  * 
  21.  * (f) THE INFORMATION BELOW IS FURNISHED AS IS, IS SUBJECT TO
  22.  *    CHANGE WITHOUT NOTICE, AND SHOULD NOT BE CONSTRUED
  23.  *    AS A COMMITMENT BY ADOBE SYSTEMS INCORPORATED.
  24.  *    ADOBE SYSTEMS INCORPORATED ASSUMES NO RESPONSIBILITY
  25.  *    OR LIABILITY FOR ANY ERRORS OR INACCURACIES, MAKES NO
  26.  *    WARRANTY OF ANY KIND (EXPRESS, IMPLIED OR STATUTORY)
  27.  *    WITH RESPECT TO THIS INFORMATION, AND EXPRESSLY
  28.  *    DISCLAIMS ANY AND ALL WARRANTIES OF MERCHANTABILITY, 
  29.  *    FITNESS FOR PARTICULAR PURPOSES AND NONINFRINGEMENT
  30.  *    OF THIRD PARTY RIGHTS.
  31.  */
  32.  
  33. /*
  34.  *    Bezier.h
  35.  *
  36.  *    This class retains the points for a  bezier curve. Since this is the only
  37.  *    graphical object class, many of the methods found here would probably
  38.  *    be found in the generic graphic object class. The areas in particular that
  39.  *    are special to a bezier are obtaining the scrolling rectangle and the
  40.  *    constraining the drawing.  Special steps are necessary because if the
  41.  *    first or last control point is selected then the second and third point
  42.  *    are used in the calculations as well. 
  43.  *
  44.  *    Version:    2.0
  45.  *    Author:    Ken Fromm
  46.  *    History:
  47.  *            03-07-91        Added this comment.
  48.  */
  49.  
  50. #import "DrawingView.h"
  51. #import <objc/Object.h>
  52.  
  53. #define COLOR                    NX_BLACK
  54. #define WIDTH                    0.15
  55.  
  56. #define  PTS_BEZIER                4
  57. #define  OPS_BEZIER                2
  58.  
  59. #define    LLX(pts)    (pts[0])
  60. #define    LLY(pts)    (pts[1])
  61. #define    URX(pts)    (pts[2])
  62. #define    URY(pts)    (pts[3])
  63.  
  64. /*
  65.  *  Instance variable - the pts array in path contains the 4 bounding
  66.  *  box coordinates plus the 4 points that describe the Bezier.
  67.  */
  68. @interface Bezier:Object
  69. {
  70.     UPath    path;            /*  Holds the user path description. */
  71. }
  72.  
  73. - initFrame:(NXRect *)frm;
  74.  
  75. - create:(const NXRect *)frm;
  76.  
  77. - (UPath *) getPath;
  78. - copyPts:sourceId;
  79.  
  80. - getBounds:(NXRect *)bRect  withKnobs:(BOOL) flag;
  81. - getPoint:(int) pt_num  :(NXPoint *) pt;
  82. - getScrollRect:(int) pt_num  :(NXRect *) aRect;
  83.  
  84. - constrainPoint:(NXPoint *)aPt  andNumber:(int) pt_num  toView:aView;
  85.  
  86. - changePoint:(int) pt_num  :(const NXPoint *) pt;
  87. - setPoint:(int) pt_num  :(const NXPoint *) pt;
  88.  
  89. - moveAll:(const NXPoint *) pt;
  90.  
  91. - (BOOL) hitControl:(const NXRect *)hitRect :(int *) pt_num  :(float) controlsize;
  92. - (BOOL) hitObject:(UPath *) hitUpath;
  93.  
  94. - putControlUPath:(UPath *) drawUpath forRect:(NXRect *)r  :(NXPoint *) lastPoint;
  95. - putControlLinesUPath:(UPath *) drawUpath  forRect:(NXRect *) r;
  96.  
  97. - drawObject:(NXRect *)r  withUcache:(BOOL)uFlag;
  98.  
  99. @end
  100.